package com.yyc.controller;

import java.util.Arrays;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.yyc.pojo.TblProduct;
import com.yyc.service.ProductService;
import com.yyc.vo.ProductInfoVo;
import com.yyc.vo.ProductVo;
import com.yyc.vo.ResultVo;

@RestController
@RequestMapping("/product")
public class ProductController {

	@Autowired
	private ProductService productService;
	
	@RequestMapping("/selectAllProduct")
	public String selectAllProduct(ModelMap map){
		List<TblProduct> product = productService.selectAll();
		map.addAttribute("product", product);
		return "product/product";
	}
	
	@RequestMapping("/list")
	public ResultVo List(){
		ResultVo resultVo = new ResultVo();
		ProductVo productVo = new ProductVo();
		ProductInfoVo productInfoVo = new ProductInfoVo();
		
		productVo.setProductInfoVos(Arrays.asList(productInfoVo));
		resultVo.setCode(1);
		resultVo.setMsg("错误");
		resultVo.setData(Arrays.asList(productVo));
		return resultVo;
	}
	
}
